package com.example.shouybl.adapter;



import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.shouybl.R;
import com.example.shouybl.bean.ActivityData;
import com.example.shouybl.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2015/10/12.
 */
public class ActivityAdapter extends AppBaseAdapter<ActivityData> {
    private DisplayImageOptions options;

    public ActivityAdapter(List<ActivityData> list, Context context) {
        super(list, context);
        options= ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        ActivityData data=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_activity_layout);
        ImageView ivHotpic= (ImageView) vh.findViewById(R.id.iv_activity_hotpic);
        TextView tvShortName= (TextView) vh.findViewById(R.id.tv_activity_shortname);
        TextView tvAname= (TextView) vh.findViewById(R.id.tv_activity_aname);
        TextView tvJoin= (TextView) vh.findViewById(R.id.total_join_user);
        TextView tvStatus= (TextView) vh.findViewById(R.id.tv_activity_status);
        ImageView ivImg= (ImageView) vh.findViewById(R.id.iv_activity_img);

        ImageLoader.getInstance().displayImage(data.getHotpic(),ivHotpic,options);
        tvShortName.setText(data.getShortname());
        tvAname.setText(data.getAname());
        tvJoin.setText(data.getTotal_join_user()+"人参与");
        tvStatus.setText(data.getStatus());


        return vh;
    }
}
